#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

size_t GetBitNum(int n)
{
	int count = 0;
	for (int i = 0; i < 32; i++)
	{
		if ((n >> i) & 1)
		{
			count++;
		}
	}

	return count;
}

size_t GetBitNum1(size_t n)
{
	int count = 0;
	while (n)
	{
		if (n % 2 == 1)
		{
			count++;
		}

		n /= 2;
	}

	return count;
}

size_t GetBitNum2(int n)
{
	int count = 0;

	while (n)
	{
		count++;
		n = n & (n - 1);
	}

	return count;
}

int main()
{
	int n = 0;
	scanf("%d", &n);
	printf("num = %u\n", GetBitNum(n));
	printf("num = %u\n", GetBitNum1(n));
	printf("num = %u\n", GetBitNum2(n));
	return 0;
}